// 存储token以及account
export const setAccount = (account) =>
{
    return sessionStorage.setItem('account', account)
}
// 删除
export const removeAccount = () =>
{
    return sessionStorage.removeItem('account')
}
// 拿取
export const getAccount = () =>
{
    return sessionStorage.getItem('account')
}
// 存储token
export const setToken = (token) =>
{
    return sessionStorage.setItem('token', token)
}
// 删除
export const removeToken = () =>
{
    return sessionStorage.removeItem('token')
}
// 拿取
export const getToken = () =>
{
    return sessionStorage.getItem('token')
}
//删除所有存储
export const removeAll = () =>
{
    // loaclStore的数据也要清空
    localStorage.clear()
    return sessionStorage.clear()
}
// 格式化时间
export const formatDate = (date) =>
{
    // 创建一个Date对象
    const originalDate = new Date(date);
    // 获取年、月、日
    const year = originalDate.getFullYear();
    const month = originalDate.getMonth() + 1; // 月份从0开始，所以要加1
    const day = originalDate.getDate();
    // 将年、月、日格式化为所需的字符串
    const formattedDate = `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
    return formattedDate
}
// 获取头像
export const getAvatarUrl = (url) =>
{
    return `${import.meta.env.BASE_IP}:8888/${url}`

}







